n,m=input().split(' ')
n=int(n)
m=int(m)

sum=0
ans=0
for i in range(n,m+1):
    flag=1
    if i==1 or i==0:
        continue
    for j in range(2,int(i**1/2+1)):
        if i%j==0:
            flag=0
            break
    if flag:
        sum+=i
        ans+=1
print(ans,sum)